derivation of electromagnetic waves